package com.boco.action;

import java.util.ArrayList;
import java.util.List;

import com.boco.dao.GetRS_HZJBXXData;
import com.boco.dao.SentData;
import com.boco.entity.RS_HZJBXX;

public class InsertRS_HZJBXXDataAction {
	public  String insertData(){
		String url = "http://fasong.cdxp.csb/json/dzbl4";
		String resule = null;
		List<RS_HZJBXX> list = new ArrayList<RS_HZJBXX>();
		list = GetRS_HZJBXXData.getData();
		String userName = "dzbl4";
		String password = "322dfbf9048445cabb06cbf24e64cdcf";
		RS_HZJBXX temp = null;
		for(int i=0;i<list.size();i++){
			String param = null;
			temp = list.get(i);
			System.out.println(temp.getHZXM());
			//按照身份证删除已经存在的值。
			param = "{\"SQL\":\"delete  RS_HZJBXX where sfzjhm='"+
					temp.getSFZJHM()
					+"' and hzxm = '"+temp.getHZXM()+"'"
					+ "\", \"ANNOTION\":\"cdxplogs\"}";
			resule = SentData.sendPost(url, param, userName, password);
			System.out.println("删除结果："+resule);
			param = "{\"SQL\":\"INSERT INTO RS_HZJBXX ("
					+ "HZZSYH,"
					+ "QYZSY,"
					+ "YLJGZZJGDM,"
					+ "SFZJHM,"
					+ "SFZJLBDM,"
					+ "JKKH,"
					+ "YBKH,"
					+ "HZXM,"
					+ "CSRQ,"
					+ "XB,"
					+ "HYZKDM,"
					+ "MZ,"
					+ "ZYLBDM,"
					+ "GZDWMC,"
					+ "XZQHDM,"
					+ "HJQDZ,"
					+ "HJDZSZZQZXS,"
					+ "HJDZSDQZ,"
					+ "HJDZXQ,"
					+ "HJDZXZJDBSC,"
					+ "HJDZCJLND,"
					+ "HJDZMPHM,"
					+ "XZQDZ,"
					+ "XZDZSZZQZXS,"
					+ "XZDZSDQZ,"
					+ "XZDZXQ,"
					+ "XZDZXZJDBSC,"
					+ "XZDZCJLND,"
					+ "XZDZMPHM,"
					+ "YZBM,"
					+ "HZDHHM,"
					+ "GZDWDHHM,"
					+ "LXRDHHM,"
					+ "LXRXM,"
					+ "YLBXLBDM,"
					+ "JDRQSJ,"
					+ "JDYY,"
					+ "JDZGH,"
					+ "JDZXM,"
					+ "ISBABY,"
					+ "MOTHER_ID,"
					+ "MOTHER_NAME,"
					+ "PARITY,"
					+ "MULTI_BIRTH_IDEN,"
					+ "BIRTH_ORDER,"
					+ "SFSLJKK,"
					+ "HEAD_URL,"
					+ "ORGCODE,"
					+ "AREACODE,"
					+ "UPLOADTIME,"
					+ "SOURCEID"
					+ ") VALUES("
					+ "'" + checkStr(temp.getHZZSYH()) + "'," 
					+ "'" + checkStr(temp.getQYZSY()) + "'," 
					+ "'" + checkStr(temp.getYLJGZZJGDM()) + "'," 
					+ "'" + checkStr(temp.getSFZJHM()) + "'," 
					+ "'" + checkStr(temp.getSFZJLBDM()) + "'," 
					+ "'" + checkStr(temp.getJKKH()) + "'," 
					+ "'" + checkStr(temp.getYBKH()) + "'," 
					+ "'" + checkStr(temp.getHZXM()) + "'," 
					+ "to_date('" + checkStr(temp.getCSRQ()) + "','yyyy-MM-dd HH24:mi:ss')," 
					+ "'" + checkStr(temp.getXB()) + "'," 
					+ "'" + checkStr(temp.getHYZKDM()) + "'," 
					+ "'" + checkStr(temp.getMZ()) + "'," 
					+ "'" + checkStr(temp.getZYLBDM()) + "'," 
					+ "'" + checkStr(temp.getGZDWMC()) + "'," 
					+ "'" + checkStr(temp.getXZQHDM()) + "'," 
					+ "'" + checkStr(temp.getHJQDZ()) + "'," 
					+ "'" + checkStr(temp.getHJDZSZZQZXS()) + "'," 
					+ "'" + checkStr(temp.getHJDZSDQZ()) + "'," 
					+ "'" + checkStr(temp.getHJDZXQ()) + "'," 
					+ "'" + checkStr(temp.getHJDZXZJDBSC()) + "'," 
					+ "'" + checkStr(temp.getHJDZCJLND()) + "'," 
					+ "'" + checkStr(temp.getHJDZMPHM()) + "'," 
					+ "'" + checkStr(temp.getXZQDZ()) + "'," 
					+ "'" + checkStr(temp.getXZDZSZZQZXS()) + "'," 
					+ "'" + checkStr(temp.getXZDZSDQZ()) + "'," 
					+ "'" + checkStr(temp.getXZDZXQ()) + "'," 
					+ "'" + checkStr(temp.getXZDZXZJDBSC()) + "'," 
					+ "'" + checkStr(temp.getXZDZCJLND()) + "'," 
					+ "'" + checkStr(temp.getXZDZMPHM()) + "'," 
					+ "'" + checkStr(temp.getYZBM()) + "'," 
					+ "'" + checkStr(temp.getHZDHHM()) + "'," 
					+ "'" + checkStr(temp.getGZDWDHHM()) + "'," 
					+ "'" + checkStr(temp.getLXRDHHM()) + "'," 
					+ "'" + checkStr(temp.getLXRXM()) + "'," 
					+ "'" + checkStr(temp.getYLBXLBDM()) + "'," 
					+ "to_date('" + checkStr(temp.getJDRQSJ()) + "','yyyy-MM-dd HH24:mi:ss')," 
					+ "'" + checkStr(temp.getJDYY()) + "'," 
					+ "'" + checkStr(temp.getJDZGH()) + "'," 
					+ "'" + checkStr(temp.getJDZXM()) + "'," 
					+ "'" + checkStr(temp.getISBABY()) + "'," 
					+ "'" + checkStr(temp.getMOTHER_ID()) + "'," 
					+ "'" + checkStr(temp.getMOTHER_NAME()) + "'," 
					+ "'" + checkStr(temp.getPARITY()) + "'," 
					+ "'" + checkStr(temp.getMULTI_BIRTH_IDEN()) + "'," 
					+ "'" + checkStr(temp.getBIRTH_ORDER()) + "'," 
					+ "'" + checkStr(temp.getSFSLJKK()) + "'," 
					+ "'" + checkStr(temp.getHEAD_URL()) + "'," 
					+ "'" + checkStr(temp.getORGCODE()) + "'," 
					+ "'" + checkStr(temp.getAREACODE()) + "'," 
					+ "sysdate," 
					+ "'dzbl4'" 
					+ ")\", \"ANNOTION\":\"cdxplogs\"}";
					resule = SentData.sendPost(url, param, userName, password);
					System.out.println(resule);
					
		}
		return resule;
		
	
		
	}
	
	public static String checkStr(Object obj){
		if (obj== null){
			obj = "";
		}
		return (String) obj;
	}
	
	
}
